package com.utils.httphelper;

import java.io.IOException;
import java.io.OutputStream;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/*调用其他地址接口

包括如何用HTTP调用其他地址接口、将传送的报文信息封装成对象转成JSON字符串传递过去和
接受返回的字符串报文转成JSON对象格式再转成map集合格式*/
public class QueryBigDataFkScoreServlet extends HttpServlet {

	private static final long serialVersionUID = 343012316346223411L;

	protected void doGet(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException {
		doPost(arg0, arg1);
	}

	protected void doPost(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException {
		QueryBigDataScoreJob queryBigJob = new QueryBigDataScoreJob();
		String exflag = "1";
		String exdesc = "成功";
		try {
			queryBigJob.dealJob();
		} catch (Exception e) {
			exflag = e.getMessage();
			if (null == exflag || "".equals(exflag)) {
				exflag = "内部错误";
			}
			exdesc = "失败";
		} finally {
			// 回传异步任务系统信息
			OutputStream outputStream = arg1.getOutputStream();
			outputStream.write(exflag.getBytes());
			outputStream.flush();
			System.out.println("调用servlet===>>" + super.getClass().getSimpleName() + exdesc + "<<");
		}
	}
}
